<template>
  <div id="addressedit">
    <van-nav-bar
      title="新增地址"
      left-text="返回"
      right-text=""
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
    <van-address-edit
      :show-area="false"
      show-delete
      show-search-result
      @save="onSave"
      @delete="onDelete"
    />
  </div>
</template>

<script>
import { Toast } from "vant";


export default {
  data() {
    return {};
  },
  methods: {
    onClickLeft() {
      Toast("返回");
      this.$router.go(-1);
    },
    onClickRight() {
      Toast("按钮");
    },
    onSave(content) {
      console.log(content);
      Toast("添加地址成功!");
      this.$store.commit('addressadd',{ userid: localStorage.getItem("id"),address: content.addressDetail,phone:content.tel,tel:content.tel,name:content.name});
      this.$router.go(-1);
    },
    onDelete() {
      Toast("delete");
    },
  },
};
</script>

<style>
</style>